import React, { Component } from 'react'
import { connect } from 'dva'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import OrgList from './List'
import AOEForm from './AOEForm'
// import PageHeaderWrapper from '@/components/PageHeaderWrapper';
@connect(state => ({
  department: state.department,
  submitting: state.loading.effects['department/save'],
}))
export default class department extends Component {
  // 组件加载完成后加载数据
  render() {
    const { dispatch, submitting } = this.props
    const { data, selectedRowKeys, modalType, currentItem } = this.props.department

    const tableProps = {
      dispatch,
      selectedRowKeys,
      data,
    }
    const modalProps = {
      data,
      dispatch,
      currentItem,
      submitting,
      modalType,
    }

    return (
      <PageHeaderWrapper title="部门管理">
        <OrgList {...tableProps} />
        {modalType !== '' && <AOEForm {...modalProps} />}
      </PageHeaderWrapper>
    )
  }
}
